package day014.homework.p3;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;

public class Test {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        Random rand = new Random();
        for (int i = 0; i < 5; i++) {
            list.add(Integer.valueOf(rand.nextInt(101)));
        }

        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i));
            if (i < list.size() - 1) {
                System.out.print(", ");
            }
        }
        System.out.println();

        Iterator<Integer> iter = list.iterator();
        while (iter.hasNext()) {
            System.out.print(iter.next());
            if (iter.hasNext()) {
                System.out.print(", ");
            }
        }
        System.out.println();

        for (Integer i : list) {
            System.out.print(i);
            System.out.print(", ");
        }
    }
}
